import request from '@/utils/request'
import type { AccountResponse } from './types/account'

enum API {
    LOGIN_URL = '/account/systeruser'
}

export const getAccountList1 = () => {
    return request.get<AccountResponse, AccountResponse>('/account/systeruser?type=1')
}

export const getAccountList2 = () => {
    return request.get<AccountResponse, AccountResponse>('/account/systeruser?type=2')
}

export const getAccountList3 = () => {
    return request.get<AccountResponse, AccountResponse>('/account/systeruser?type=3')
}

//添加账号
export const addAccountList = (datas: any) => {
 
    return request<AccountResponse,AccountResponse>({
        method:"post",
        url:"/account/systeruser",
        data:datas
    })
}


//改密码
export const updateAccountList = (datas: any) => {
    // const formData = new FormData()
    // formData.append('username', params.username)
    // formData.append('password', params.password)
    return request<AccountResponse,AccountResponse>({
        method:"put",
        url:"/account/systeruser",
        data:datas
    })
}
//校验存在
export const valAccountList = (data: any) => {
    return request.get<AccountResponse, AccountResponse>(
        `${API.LOGIN_URL}?username=${data}`
    )
}

